﻿using System;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Serialization;

namespace openSourceC.DaylifeClient
{
	/// <summary>
	///		Summary description for Response.
	/// </summary>
	[Serializable]
	[XmlRoot("response")]
	public class BatchResponse
	{
		/// <summary>
		///		Gets a <see cref="Nullable&lt;BatchResponseCodeEnum&gt;"/> representation of <see cref="P:Code"/>.
		///	</summary>
		[XmlIgnore]
		public BatchResponseCodeEnum? CodeEnum
		{
			get { return (BatchResponseCodeEnum?)Code; }
		}

		/// <summary>Gets or sets the response code.</summary>
		[XmlElement("code")]
		public int? Code { get; set; }

		/// <summary>Gets or sets the response message.</summary>
		[XmlElement("message")]
		public string Message { get; set; }

		/// <summary>Gets or sets the payload collection.</summary>
		[XmlAnyElement("payload")]
		public List<XmlElement> Payloads { get; set; }

		/// <summary>The deserialized <see cref="BatchPayloadResponse"/> objects contained within
		///		<see cref="Payloads"/>.</summary>
		[XmlIgnore]
		public List<BatchPayloadResponse> Responses { get; set; }


		/// <summary>Gets or sets the array of all the out-of-band elements.</summary>
		[XmlAnyElement]
		public XmlElement[] ZElements { get; set; }
	}

	/// <summary>
	///		Summary description for BatchPayloadResponse.
	/// </summary>
	[Serializable]
	[XmlRoot("response")]
	public class BatchPayloadResponse : Response
	{
		/// <summary>Gets or sets the request identifier.</summary>
		[XmlElement("request_id")]
		public string RequestId { get; set; }
	}
}
